package cn.rongdao.jrkabao.ui.deposit.account.uicomponent;

import android.content.Context;
import android.support.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.mifengkong.frtools.util.FRCollection;
import com.mifengkong.frtools.util.FRString;

import cn.rongdao.jrkabao.R;

/**
 * Created by jack on 2017/7/28
 */

public class ActivityUIComponent extends LinearLayout {
    public ActivityUIComponent(Context context) {
        super(context);
    }

    public ActivityUIComponent(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public ActivityUIComponent(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    private TextView tvTitle;
    private TextView tvContent;

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        tvTitle = (TextView) findViewById(R.id.la_tv_title);
        tvContent = (TextView) findViewById(R.id.la_tv_content);
    }

    private void setContent(String content) {
        tvContent.setText(FRCollection.appendAsString("+", FRString.valueOf(content), ""));
    }

    public void setCashAdvanceDrawable(String content) {
        setContent(content);
        tvTitle.setText(FRString.valueOf("取现活动"));
        tvTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.dot_cash_advance_activity, 0, 0, 0);
    }

    public void setActivityDrawable(String content) {
        setContent(content);
        tvTitle.setText(FRString.valueOf("贷款活动"));
        tvTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.dot_loan_activity, 0, 0, 0);
    }

    public void setOtherDrawable(String content) {
        setContent(content);
        tvTitle.setText(FRString.valueOf("其他"));
        tvTitle.setCompoundDrawablesWithIntrinsicBounds(R.drawable.dot_other_activity, 0, 0, 0);
    }
}